package com.hn658.base.message.appinfo.enums;


/**
 * 
 * 队列类型
 * @author ztjie
 * @date 2015-11-19 下午7:43:24
 * @since
 * @version
 */
public enum QueueType {
	
	Queue(1, "Queue", "队列"),
	
	Topic(2, "Topic", "主题");

	/**
	 * 类型编码
	 */
	private Integer code;
	
	/**
	 * 类型
	 */
	private String type;
	
	/**
	 * 类型说明
	 */
	private String name;
	
	QueueType(Integer code, String type, String name){
		this.code = code;
		this.name = name;
		this.type = type;
	}

	public Integer getCode() {
		return code;
	}

	public void setCode(Integer code) {
		this.code = code;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	
	/**
     * 根据code值获取对应的枚举
     * @param code
     * @return
     */
    public static QueueType getTypeByCode(int code){
        for(QueueType type : QueueType.values()){
            if(type.getCode() == code){
                return type;
            }
        }
        return null;
    }
}
